/**
 * WlApplyTempalteExport.java
 * <p>
 * Copyright 2012 Petro-CyberWorks Information & Technology Co., Ltd.	All right reserved.
 */
package com.liangtian.mdm.material.excel;

import com.liangtian.mdm.material.common.exception.BaseRuntimeException;
import com.liangtian.mdm.material.model.*;
import com.liangtian.mdm.system.parameter.utils.SysParamUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.*;

import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;


/**
 * 使用POI导出物料申请模板，导出EXCEL2007版
 * @author hanxg
 * @since 2014-3-4
 */
public class WlApplyTempalteExport {

    private HttpServletResponse response = null;

    private WlLb wlLb = null;// 类别

    private WlLbmb wlLbmb = null;// 类别模板

    private List<WlLbmbtzlDto> tzlList = null;// 特征量数据

    private List<WlbmLbJldw> lbjldwList = null;// 类别计量单位数据

    private String mbName = "";//导出的excel文件名称

    private List<WlwlField> fieldList = null;//物料可配置业务字段

    private Map<String, Object> map = null;//17-08-25新增

    public WlApplyTempalteExport(HttpServletResponse response, WlLb wlLb
            , WlLbmb wlLbmb, List<WlLbmbtzlDto> tzlList, List<WlbmLbJldw> lbjldwList
            , List<WlwlField> fieldList, Map<String, Object> map) {
        this.response = response;
        this.wlLb = wlLb;
        this.wlLbmb = wlLbmb;
        if (tzlList == null) {
            tzlList = new ArrayList<WlLbmbtzlDto>();
        }
        this.tzlList = tzlList;
        this.lbjldwList = lbjldwList;
        this.fieldList = fieldList;
        this.map = map;
        mbName = "物料导入模板(" + wlLb.getLbbm() + wlLb.getLbmc() + "_" + wlLbmb.getMbname() + ").xlsx";
    }

    /**
     * 获取特征量取值附表所在单元格区间表示
     * @param columnIndex
     * @param size
     * @return
     * @author hanxg
     * @date 2014-3-6
     */
    String getCellRange(int columnIndex, int size) {
        char firstCol = 'A';
        char currCol = (char) (firstCol + columnIndex);
        return "$" + currCol + "$" + 2 + ":$" + currCol + "$" + (size + 1);
    }

    @SuppressWarnings("unchecked")
    void writeQzCell(Sheet sheet, WlLbmbtzlDto tzl, int columnIndex, CellStyle style) {
        List<WlLbmbtzlqz> qzList = tzl.getTzlzList();
        Row row = sheet.getRow(0);
        if (row == null) {
            row = sheet.createRow(0);
        }
        Cell cell = row.createCell(columnIndex);
        cell.setCellValue("【" + tzl.getTzlmc() + "】取值");
        cell.setCellStyle(style);
        if (!ObjectUtils.isEmpty(qzList)) {
            for (int i = 0; i < qzList.size(); i++) {
                row = sheet.getRow(i + 1);
                if (row == null) {
                    row = sheet.createRow(i + 1);
                }
                cell = row.createCell(columnIndex);
                cell.setCellValue(qzList.get(i).getQz());
                cell.setCellStyle(style);
            }
        }
    }

    void writeFieldCell(Sheet sheet, List<Map<String, Object>> list, String fieldName, int columnIndex, CellStyle style) {
        Row row = sheet.getRow(0);
        if (row == null) {
            row = sheet.createRow(0);
        }
        Cell cell = row.createCell(columnIndex);
        cell.setCellValue("【" + fieldName + "】取值");
        cell.setCellStyle(style);
        if (!ObjectUtils.isEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                row = sheet.getRow(i + 1);
                if (row == null) {
                    row = sheet.createRow(i + 1);
                }
                cell = row.createCell(columnIndex);
                cell.setCellValue((String) list.get(i).get("c_001"));
                cell.setCellStyle(style);
            }
        }
    }

    @SuppressWarnings({"unchecked", "resource"})
    public void createExcel() {
        OutputStream outs = null;
        try {
            outs = response.getOutputStream();
            this.setResponseHeader();
            // 声明一个工作薄
            XSSFWorkbook workbook = new XSSFWorkbook();
            XSSFSheet sheet = workbook.createSheet("模板_" + wlLbmb.getId());
            XSSFSheet qzSheet = workbook.createSheet("取值附表");
            DataFormat format = workbook.createDataFormat();
            sheet.setColumnWidth(0, 30*256);
            sheet.setColumnWidth(1, 30*256);

            XSSFCellStyle style = workbook.createCellStyle();
            style.setAlignment(HorizontalAlignment.CENTER);
            style.setVerticalAlignment(VerticalAlignment.CENTER);
            XSSFFont font = workbook.createFont();
            font.setBold(true);
            font.setFontHeight(10);
            style.setFont(font);
            style.setDataFormat(format.getFormat("@"));

            XSSFCellStyle style2 = workbook.createCellStyle();
            style2.setAlignment(HorizontalAlignment.CENTER);
            style2.setVerticalAlignment(VerticalAlignment.CENTER);
            XSSFFont font2 = workbook.createFont();
            font2.setFontHeight(10);
            style2.setFont(font2);
            style2.setDataFormat(format.getFormat("@"));

            XSSFCellStyle style3 = workbook.createCellStyle();
            XSSFFont font3 = workbook.createFont();
            font3.setFontHeight(10);
            style3.setFont(font2);
            style3.setDataFormat(format.getFormat("@"));

            XSSFCell cell = null;
            Comment comment = null;
            XSSFRow row1 = sheet.createRow(0);
            int hcol = 2;
            for (int j = 0; j < tzlList.size(); j++) {
                WlLbmbtzlDto tzlDto = tzlList.get(j);
                cell = row1.createCell(hcol);
                sheet.setDefaultColumnStyle(hcol, style);
                cell.setCellValue(new XSSFRichTextString("特征量" + (j + 1) + " " + tzlDto.getTzlmc()));
                cell.setCellStyle(style);
                sheet.addMergedRegion(new CellRangeAddress(0, 0, hcol, hcol + 4));
                hcol += 5;
            }

            DataValidationHelper dvHelper = sheet.getDataValidationHelper();
            CreationHelper factory = workbook.getCreationHelper();
            Drawing drawing = sheet.createDrawingPatriarch();
            ClientAnchor anchor = factory.createClientAnchor();

            XSSFRow row2 = sheet.createRow(1);
            XSSFRow row3 = sheet.createRow(2);

            cell = row2.createCell(0);
            sheet.setDefaultColumnStyle(0, style2);
            cell.setCellValue("长描述");
            cell.setCellStyle(style2);
            comment = drawing.createCellComment(anchor);
            comment.setString(new XSSFRichTextString("允许不填长描述"));
            cell.setCellComment(comment);

            cell = row2.createCell(1);
            sheet.setDefaultColumnStyle(1, style2);
            cell.setCellValue("短描述");
            cell.setCellStyle(style2);
            comment = drawing.createCellComment(anchor);

            //--edit by wangyk at 180410 start:新凤鸣短描述没有40的限制
            //--edit by wangyk at 180622:
            //--新凤鸣又取消了短描述可以超过40的限制，现在和产品一致了......
            //--使用简单的处理方式，将IF分支的判断由XFM改成XXX，保留功能以后实施的哪个项目可以使用这种逻辑
            String systemCode = SysParamUtil.getParameterValue("systemCode");
            if ("XXX".equals(systemCode)) {
                comment.setString(new XSSFRichTextString("不允许为空"));
            } else {
                comment.setString(new XSSFRichTextString("不允许为空，不允许超过40字符"));
            }
            //--edit by wangyk at 180410 end
            cell.setCellComment(comment);

            int col = 2;
            for (int t = 0; t < tzlList.size(); t++) {
                WlLbmbtzlDto tzlDto = tzlList.get(t);
                writeQzCell(qzSheet, tzlDto, t, style3);//把取值附表写到第二个sheet中
                cell = row2.createCell(col);
                sheet.setDefaultColumnStyle(col, style2);
                cell.setCellValue("前置符号");
                cell.setCellStyle(style2);
                if (StringUtils.trimToEmpty(tzlDto.getQzfhsfkk()).equals("1")) {
                    comment = drawing.createCellComment(anchor);
                    comment.setString(new XSSFRichTextString("不允许为空"));
                    cell.setCellComment(comment);
                }
                cell = row2.createCell(col + 1);
                sheet.setDefaultColumnStyle(col + 1, style2);
                cell.setCellValue("特征量取值");
                cell.setCellStyle(style2);
                String tmpinfo = "";
                if (StringUtils.trimToEmpty(tzlDto.getNecessary()).equals("1")) {
                    tmpinfo = "必填";
                } else {
                    tmpinfo = "非必填";
                }
                if (StringUtils.trimToEmpty(tzlDto.getChooseable()).equals("1")) {
                    tmpinfo += "，必选";
                } else {
                    tmpinfo += "，非必选";
                }
                comment = drawing.createCellComment(anchor);
                comment.setString(new XSSFRichTextString(tmpinfo));
                cell.setCellComment(comment);
                cell = row2.createCell(col + 2);
                sheet.setDefaultColumnStyle(col + 2, style2);
                cell.setCellValue("后置符号");
                cell.setCellStyle(style2);
                if (StringUtils.trimToEmpty(tzlDto.getHzfhsfkk()).equals("1")) {
                    comment = drawing.createCellComment(anchor);
                    comment.setString(new XSSFRichTextString("不允许为空"));
                    cell.setCellComment(comment);
                }
                cell = row2.createCell(col + 3);
                sheet.setDefaultColumnStyle(col + 3, style2);
                cell.setCellValue("计量单位");
                cell.setCellStyle(style2);
                cell = row2.createCell(col + 4);
                sheet.setDefaultColumnStyle(col + 4, style2);
                cell.setCellValue("连接符号");
                cell.setCellStyle(style2);
                comment = drawing.createCellComment(anchor);
                comment.setString(new XSSFRichTextString("若需要用空格作为连接符，请填入“空格”两字"));
                cell.setCellComment(comment);

                if (!CollectionUtils.isEmpty(tzlDto.getQzfhList())) {
                    List<WlLbmbTzlfh> list = tzlDto.getQzfhList();
                    if (list.size() == 1) {
                        cell = row3.createCell(col);
                        sheet.setDefaultColumnStyle(col, style3);
                        cell.setCellValue(list.get(0).getFhname());
                        cell.setCellStyle(style3);
                    } else {
                        try {
                            String[] fhs = new String[list.size()];
                            boolean flag = false;
                            for (int k = 0; k < list.size(); k++) {
                                WlLbmbTzlfh fh = list.get(k);
                                if (fh.getFhname().indexOf("\"") != -1) {
                                    flag = true;
                                    fhs[k] = fh.getFhname().replace("\"", "&quot;");
                                } else {
                                    fhs[k] = fh.getFhname();
                                }
                            }
                            //System.out.println("前置符号："+StringUtil.arrayToStringBySplit(fhs, ","));
                            DataValidationConstraint constraint = dvHelper.createExplicitListConstraint(fhs);
                            CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col, col);
                            DataValidation validation = dvHelper.createValidation(constraint, addressList);
                            validation.setShowErrorBox(true);
                            if (flag) {
                                validation.setShowPromptBox(true);
                                validation.createPromptBox("重要提示：", "请先在数据有效性设置中将&quot;替换成有效的\"");
                            }
                            sheet.addValidationData(validation);
                        } catch (Exception e) {
                            System.out.println("设置前置符号数据有效性异常：" + e.getMessage());
                        }
                    }
                }
                if (!CollectionUtils.isEmpty(tzlDto.getTzlzList()) && tzlDto.getTzlzList().size() <= 800) {
                    try {
						/*List<WlLbmbtzlqz> list = tzlDto.getTzlzList();
						String[] qzs = new String[list.size()];
						boolean flag = false;
						for(int k=0; k<list.size(); k++){
							WlLbmbtzlqz qz = list.get(k);
							if(qz.getQz().indexOf("\"")!=-1){
								flag = true;
								qzs[k] = qz.getQz().replace("\"", "&quot;");
							}else{
								qzs[k] = qz.getQz();
							}
						}
						System.out.println("取值："+StringUtil.arrayToStringBySplit(qzs, ","));*/
                        String qzfbcell = "qzfbcell" + t;
                        XSSFName xname = (XSSFName) workbook.createName();
                        xname.setNameName(qzfbcell);
                        xname.setComment("请勿更改");
                        xname.setRefersToFormula("取值附表!" + this.getCellRange(t, tzlDto.getTzlzList().size()));
                        DataValidationConstraint constraint = dvHelper.createFormulaListConstraint(qzfbcell);
                        //System.out.println(constraint.getFormula1());
                        CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col + 1, col + 1);
                        DataValidation validation = dvHelper.createValidation(constraint, addressList);
                        validation.setShowErrorBox(false);
                        sheet.addValidationData(validation);
                    } catch (Exception e) {
                        System.out.println("设置取值数据有效性异常：" + e.getMessage());
                    }
                }
                if (!CollectionUtils.isEmpty(tzlDto.getHzfhList())) {
                    List<WlLbmbTzlfh> list = tzlDto.getHzfhList();
                    if (list.size() == 1) {
                        cell = row3.createCell(col + 2);
                        sheet.setDefaultColumnStyle(col + 2, style3);
                        cell.setCellValue(list.get(0).getFhname());
                        cell.setCellStyle(style3);
                    } else {
                        try {
                            String[] fhs = new String[list.size()];
                            boolean flag = false;
                            for (int k = 0; k < list.size(); k++) {
                                WlLbmbTzlfh fh = list.get(k);
                                if (fh.getFhname().indexOf("\"") != -1) {
                                    flag = true;
                                    fhs[k] = fh.getFhname().replace("\"", "&quot;");
                                } else {
                                    fhs[k] = fh.getFhname();
                                }
                            }
                            //System.out.println("后置符号："+StringUtil.arrayToStringBySplit(fhs, ","));
                            DataValidationConstraint constraint = dvHelper.createExplicitListConstraint(fhs);
                            CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col + 2, col + 2);
                            DataValidation validation = dvHelper.createValidation(constraint, addressList);
                            validation.setShowErrorBox(true);
                            if (flag) {
                                validation.setShowPromptBox(true);
                                validation.createPromptBox("重要提示：", "请先在数据有效性设置中将&quot;替换成有效的\"");
                            }
                            sheet.addValidationData(validation);
                        } catch (Exception e) {
                            System.out.println("设置后置符号数据有效性异常：" + e.getMessage());
                        }
                    }
                }
                if (!CollectionUtils.isEmpty(tzlDto.getJldwList())) {
                    List<WlLbmbTzlfh> list = tzlDto.getJldwList();
                    if (list.size() == 1) {
                        cell = row3.createCell(col + 3);
                        sheet.setDefaultColumnStyle(col + 3, style3);
                        cell.setCellValue(list.get(0).getFhname());
                        cell.setCellStyle(style3);
                    } else {
                        try {
                            String[] fhs = new String[list.size()];
                            boolean flag = false;
                            for (int k = 0; k < list.size(); k++) {
                                WlLbmbTzlfh fh = list.get(k);
                                if (fh.getFhname().indexOf("\"") != -1) {
                                    flag = true;
                                    fhs[k] = fh.getFhname().replace("\"", "&quot;");
                                } else {
                                    fhs[k] = fh.getFhname();
                                }
                            }
                            DataValidationConstraint constraint = dvHelper.createExplicitListConstraint(fhs);
                            CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col + 3, col + 3);
                            DataValidation validation = dvHelper.createValidation(constraint, addressList);
                            validation.setShowErrorBox(true);
                            if (flag) {
                                validation.setShowPromptBox(true);
                                validation.createPromptBox("重要提示：", "请先在数据有效性设置中将&quot;替换成有效的\"");
                            }
                            sheet.addValidationData(validation);
                        } catch (Exception e) {
                            System.out.println("设置计量单位数据有效性异常：" + e.getMessage());
                        }
                    }
                }
                if (!CollectionUtils.isEmpty(tzlDto.getLjfhList())) {
                    List<WlLbmbTzlfh> list = tzlDto.getLjfhList();
                    if (list.size() == 1) {
                        cell = row3.createCell(col + 4);
                        sheet.setDefaultColumnStyle(col + 4, style3);
                        cell.setCellValue(list.get(0).getFhname());
                        cell.setCellStyle(style3);
                    } else {
                        try {
                            String[] fhs = new String[list.size()];
                            boolean flag = false;
                            for (int k = 0; k < list.size(); k++) {
                                WlLbmbTzlfh fh = list.get(k);
                                if (fh.getFhname().indexOf("\"") != -1) {
                                    flag = true;
                                    fhs[k] = fh.getFhname().replace("\"", "&quot;");
                                } else {
                                    fhs[k] = fh.getFhname();
                                }
                            }
                            //System.out.println("连接符号："+StringUtil.arrayToStringBySplit(fhs, ","));
                            DataValidationConstraint constraint = dvHelper.createExplicitListConstraint(fhs);
                            CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col + 4, col + 4);
                            DataValidation validation = dvHelper.createValidation(constraint, addressList);
                            validation.setShowErrorBox(true);
                            if (flag) {
                                validation.setShowPromptBox(true);
                                validation.createPromptBox("重要提示：", "请先在数据有效性设置中将&quot;替换成有效的\"");
                            }
                            sheet.addValidationData(validation);
                        } catch (Exception e) {
                            System.out.println("设置连接符号数据有效性异常：" + e.getMessage());
                        }
                    }
                }

                col += 5;//用于第二、三行计数
            }
            cell = row2.createCell(col);
            sheet.setDefaultColumnStyle(col, style2);
            cell.setCellValue("物料计量单位");
            cell.setCellStyle(style2);
            comment = drawing.createCellComment(anchor);
            comment.setString(new XSSFRichTextString("不允许为空"));
            cell.setCellComment(comment);
            if (!CollectionUtils.isEmpty(lbjldwList)) {
                if (lbjldwList.size() == 1) {
                    cell = row3.createCell(col);
                    sheet.setDefaultColumnStyle(col, style3);
                    cell.setCellValue(lbjldwList.get(0).getMc());
                    cell.setCellStyle(style3);
                } else {
                    String[] dms = new String[lbjldwList.size()];
                    boolean flag = false;
                    for (int k = 0; k < lbjldwList.size(); k++) {
                        WlbmLbJldw jldw = lbjldwList.get(k);
                        if (jldw.getMc().indexOf("\"") != -1) {
                            flag = true;
                            dms[k] = jldw.getMc().replace("\"", "&quot;");
                        } else {
                            dms[k] = jldw.getMc();
                        }
                    }
                    DataValidationConstraint constraint = dvHelper.createExplicitListConstraint(dms);
                    CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col, col);
                    DataValidation validation = dvHelper.createValidation(constraint, addressList);
                    validation.setShowErrorBox(true);
                    if (flag) {
                        validation.setShowPromptBox(true);
                        validation.createPromptBox("重要提示：", "请先在数据有效性设置中将&quot;替换成有效的\"");
                    }
                    sheet.addValidationData(validation);
                }
            }
            ++col;
            //万达物料无上层代码
			/*if(StringUtils.trimToEmpty(wlLb.getWzcpbz()).equals("2")){
				cell=row2.createCell(col++);
				cell.setCellValue("上层代码（产品）");
				cell.setCellStyle(style2);
				comment = drawing.createCellComment(anchor);
				comment.setString(new XSSFRichTextString("不允许为空"));
				cell.setCellComment(comment);
				cell=row2.createCell(col++);
				cell.setCellValue("上层名称（产品）");
				cell.setCellStyle(style2);
				comment = drawing.createCellComment(anchor);
				comment.setString(new XSSFRichTextString("不允许为空"));
				cell.setCellComment(comment);
				cell=row2.createCell(col++);
				cell.setCellValue("分类码（产品）");
				cell.setCellStyle(style2);
			}*/
            //以下字段已实现可配置化
			/*cell=row2.createCell(col++);
			cell.setCellValue("原系统代码");
			cell.setCellStyle(style2);
			cell=row2.createCell(col++);
			cell.setCellValue("原系统名称");
			cell.setCellStyle(style2);
			cell=row2.createCell(col++);
			cell.setCellValue("条码");
			cell.setCellStyle(style2);
			cell=row2.createCell(col++);
			cell.setCellValue("物料说明");
			cell.setCellStyle(style2);*/

            //以下为用户自己配置的表单中的业务字段
            for (int i = 0; i < fieldList.size(); i++) {
                //万达专有（ERP物料模版下拉列表形式）
                if ("field5".equals(fieldList.get(i).getField()) && "select".equals(fieldList.get(i).getFieldType())) {
                    cell = row2.createCell(col);
                    sheet.setDefaultColumnStyle(col, style2);
                    cell.setCellValue(fieldList.get(i).getFieldName());
                    cell.setCellStyle(style2);
                    try {
                        List<Map<String, Object>> field5List = (List<Map<String, Object>>) map.get("field5List");
                        boolean flag = false;
                        if (!CollectionUtils.isEmpty(field5List)) {
                            if (field5List.size() == 1) {
                                cell = row3.createCell(col);
                                sheet.setDefaultColumnStyle(col, style3);
                                cell.setCellValue((String) field5List.get(0).get("c_001"));
                                cell.setCellStyle(style3);
                            } else {
                                String[] fields = new String[field5List.size()];
                                for (int k = 0; k < field5List.size(); k++) {
                                    String name = (String) field5List.get(k).get("c_001");
                                    if (name.indexOf("\"") != -1) {
                                        flag = true;
                                        fields[k] = name.replace("\"", "&quot;");
                                    } else {
                                        fields[k] = name;
                                    }
                                }
                                DataValidationConstraint constraint = dvHelper.createExplicitListConstraint(fields);
                                CellRangeAddressList addressList = new CellRangeAddressList(2, 2, col, col);
                                DataValidation validation = dvHelper.createValidation(constraint, addressList);
                                validation.setShowErrorBox(true);
                                if (flag) {
                                    validation.setShowPromptBox(true);
                                    validation.createPromptBox("重要提示：", "请先在数据有效性设置中将&quot;替换成有效的\"");
                                }
                                sheet.addValidationData(validation);
                            }

                        }
                    } catch (Exception e) {
                        System.out.println("设置ERP物料模版有效性异常：" + e.getMessage());
                    }

                } else if ("轮胎认证信息（橡胶专用）".equals(fieldList.get(i).getFieldName()) && "select".equals(fieldList.get(i).getFieldType())) {
                    cell = row2.createCell(col);
                    sheet.setDefaultColumnStyle(col, style2);
                    cell.setCellValue(fieldList.get(i).getFieldName());
                    cell.setCellStyle(style2);
                    comment = drawing.createCellComment(anchor);
                    comment.setString(new XSSFRichTextString("值请以,(英文逗号)隔开"));
                    cell.setCellComment(comment);
                    //万达 ---END
                } else {
                    cell = row2.createCell(col);
                    sheet.setDefaultColumnStyle(col, style2);
                    cell.setCellValue(fieldList.get(i).getFieldName());
                    cell.setCellStyle(style2);
                }
                col++;
            }

            //备注
            cell = row2.createCell(col++);
            sheet.setDefaultColumnStyle(col++, style2);
            cell.setCellValue("备注");
            cell.setCellStyle(style2);

            workbook.write(outs);
            outs.flush();
        } catch (Exception e) {
            throw new BaseRuntimeException("创建Workbook发生异常", e);
        } finally {
            try {
                if (outs != null) {
                    outs.close();
                }
            } catch (Exception e) {
                throw new BaseRuntimeException("导出excel关闭流时发生异常", e);
            }
        }

    }

    /** 设置响应头 */
    void setResponseHeader() {
        try {
            mbName = new String(mbName.getBytes("GBK"), "iso8859-1");
            response.setContentType("application/octet-stream");
            response.setHeader("Content-Disposition", "attachment;filename=" + mbName);
            response.addHeader("Pargam", "no-cache");
            response.addHeader("Cache-Control", "no-cache");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public HttpServletResponse getResponse() {
        return response;
    }

    public void setResponse(HttpServletResponse response) {
        this.response = response;
    }

    public String getMbName() {
        return mbName;
    }

    public void setMbName(String mbName) {
        this.mbName = mbName;
    }

    public WlLb getWlLb() {
        return wlLb;
    }

    public void setWlLb(WlLb wlLb) {
        this.wlLb = wlLb;
    }

    public WlLbmb getWlLbmb() {
        return wlLbmb;
    }

    public void setWlLbmb(WlLbmb wlLbmb) {
        this.wlLbmb = wlLbmb;
    }

    public List<WlLbmbtzlDto> getTzlList() {
        return tzlList;
    }

    public void setTzlList(List<WlLbmbtzlDto> tzlList) {
        this.tzlList = tzlList;
    }

    public List<WlbmLbJldw> getLbjldwList() {
        return lbjldwList;
    }

    public void setLbjldwList(List<WlbmLbJldw> lbjldwList) {
        this.lbjldwList = lbjldwList;
    }

}
